package com.itheima.stock.mapper;

import com.itheima.stock.pojo.domain.StockUpdownDomain;
import com.itheima.stock.pojo.domain.Stock4EvrDayDomain;
import com.itheima.stock.pojo.entity.Stock4MinuteDomain;
import com.itheima.stock.pojo.entity.StockRtInfo;
import com.itheima.stock.pojo.vo.updowncount;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author 46035
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-09-19 15:48:56
* @Entity com.itheima.stock.pojo.entity.StockRtInfo
*/
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    List<StockUpdownDomain> getNewestStockInfo( @Param("curDate") Date curDate);

    List<StockUpdownDomain> getincrease( @Param("curDate") Date curDate);

    List<updowncount> getupdowncount(Date curDate);

    List<updowncount> gettradeAmt(@Param("start") Date start, @Param("end") Date end, @Param("inner") List<String> inner);

    List<Map> getStockUpDownSectionByTime(Date curDate);

    List<Stock4MinuteDomain> getStockInfoByCodeAndDate(@Param("stockcode") String stockcode,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

    @Select("select max(cur_time) from stock_rt_info where cur_time between #{startTime} and #{endTime} and stock_code = #{stockCode} group by date_format(cur_time,'%Y%m%d') ")
    List<Date> getEndTime ( @Param("stockCode") String stockCode, @Param("startTime") Date startTime, @Param("endTime") Date endTime);


    List<Stock4EvrDayDomain> getStockInfo4EvrDay(@Param("endTime") List<Date> endTime);

    void insertBatch(List<StockRtInfo> infos);

    void insertInfo(@Param("list1") List<StockRtInfo> list1);
}
